
#ifndef __avmplus_avmbind__
#define __avmplus_avmbind__

#define DEV_BIND extern "C" __declspec(dllexport) 

#include "avmrt.h"

#define STDCALL		__stdcall				/* Standard calling convention */

typedef unsigned long		DWORD;		// 32-bit unsigned.

#ifdef __cplusplus
extern "C" 
{
#endif

/*

 AVM BIND

*/

DEV_API String *avmbind_String( char *str, int len );
DEV_API char *avmbind_String_toCstr(String *str);
DEV_API Atom avmbind_String_atom(String *str);
DEV_API void avmbind_String_append(String *dst,String *src);

DEV_API void *avm_queryInterface( ScriptObject *obj );

DEV_API wchar *avmbind_String_toUTF16(String *str);
DEV_API int avmbind_String_getLength(String *str);


DEV_API ScriptObject *avmbind_Object();
DEV_API Atom avmbind_Object_atom(ScriptObject *o);

DEV_API Atom avmbind_Object_callProperty(ScriptObject *obj,char *name,int argc, Atom *argv);
DEV_API Atom avmbind_Object_callMultinameProperty(ScriptObject *obj,char *uri,char *name,int argc, Atom *argv);

DEV_API Atom avm_Object_getSlot( ScriptObject* obj , int id );
DEV_API void avm_Object_setSlot( ScriptObject* obj ,int id,  Atom value );

DEV_API void *avmbind_Object_getDataPointer( ScriptObject* obj );

DEV_API ScriptObject *avmbind_ByteArray( );
DEV_API int avmbind_ByteArray_getLength( ScriptObject* obj );
DEV_API void avmbind_ByteArray_setLength( ScriptObject* obj, int len );
DEV_API void avmbind_ByteArray_writeBytes( ScriptObject* obj, char *bytes, int len );
DEV_API void avmbind_ByteArray_readBytes( ScriptObject* obj, char *bytes, int len );
DEV_API char *avmbind_ByteArray_getWritableBuffer( ScriptObject* obj );
DEV_API void avmbind_ByteArray_ensureCapacity( ScriptObject* obj, int capacity );

DEV_API Atom avmbind_Array_getItem( ScriptObject *obj, int index );
DEV_API void avmbind_Array_setItem( ScriptObject *obj, int index, Atom value );
DEV_API int avmbind_Array_getLength( ScriptObject *obj );
DEV_API void avmbind_Array_push( ScriptObject *obj, Atom value );
DEV_API Atom avmbind_Array_pop( ScriptObject *obj );

DEV_API Atom avmbind_Vector_getItem( ScriptObject *obj, int index );
DEV_API void avmbind_Vector_setItem( ScriptObject *obj, int index, Atom value );
DEV_API int avmbind_Vector_getLength( ScriptObject *obj );
DEV_API void avmbind_Vector_push( ScriptObject *obj, Atom value );
DEV_API Atom avmbind_Vector_pop( ScriptObject *obj );

DEV_API int avmbind_IntVector_getItem( ScriptObject *obj, int index );
DEV_API void avmbind_IntVector_setItem( ScriptObject *obj, int index, int value );

DEV_API double avmbind_DoubleVector_getItem( ScriptObject *obj, int index );
DEV_API void avmbind_DoubleVector_setItem( ScriptObject *obj, int index, double value );


DEV_API ScriptObject* avmbind_ObjectVector_getItem( ScriptObject *obj, int index );
DEV_API void avmbind_ObjectVector_setItem( ScriptObject *obj, int index, ScriptObject *value );

#ifdef __cplusplus
}
#endif

#endif